package io.github.uicdb.gravity_generator.data;

import io.github.uicdb.gravity_generator.GGRegistries;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;

import java.util.function.Consumer;

public class GGRecipeGenerator extends RecipeProvider {
    public GGRecipeGenerator(DataGenerator dataGenerator) {
        super(dataGenerator);
    }

    @Override
    protected void buildCraftingRecipes(@NotNull Consumer<FinishedRecipe> finishedRecipeConsumer) {
        ShapedRecipeBuilder.shaped(GGRegistries.GRAVITY_GENERATOR.get())
                .pattern("CYC")
                .pattern("CFC")
                .pattern("III")
                .define('C', Items.COPPER_INGOT)
                .define('Y', ItemTags.WOODEN_PRESSURE_PLATES)
                .define('I',Items.IRON_INGOT)
                .define('F', Items.FURNACE)
                .unlockedBy("hasIron",has(Items.IRON_INGOT))
                .save(finishedRecipeConsumer);
        ShapedRecipeBuilder.shaped(GGRegistries.HARMLESS_GRAVITY_GENERATOR.get())
                .pattern("SSS")
                .pattern("GXG")
                .pattern("DDD")
                .define('S', Items.SPONGE)
                .define('G',GGRegistries.GRAVITY_GENERATOR_ITEM.get())
                .define('X',Items.NETHER_STAR)
                .define('D',Items.DIAMOND)
                .unlockedBy("hasNetherStar",has(Items.NETHER_STAR))
                .save(finishedRecipeConsumer);
    }

    @NotNull
    @Override
    public String getName() {
        return "GGRecipeGenerator";
    }
}
